package code.module.loading
{
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;

	/**
	 *加载调控制器 
	 * @author YY
	 * 
	 */
	public class LoadingCtrl
	{
		private var _loadingPanle:LoadingPanle;
		public function LoadingCtrl(container:DisplayObjectContainer)
		{
			_loadingPanle = new LoadingPanle();
			var dobj:DisplayObject;
			dobj = container.addChild(_loadingPanle);
			dobj.x = 380;
			dobj.y = 340;
		}
		
		/**
		 *设置加载数据 
		 * 
		 */
		public function setLoadData(loaded:int, total:int):void {
			_loadingPanle.loadDingBar.gotoAndStop(int(loaded/total*100));
		}
		/**
		 *设置提示信息 
		 * @param str
		 * 
		 */
		public function setTips(str:String):void {
			trace(str);
		}
		
		/**
		 *释放资源 
		 * 
		 */
		public function dispose():void {
			if(this._loadingPanle.parent) {
				this._loadingPanle.parent.removeChild(this._loadingPanle);
			}
			this._loadingPanle = null;
		}
	}
}